// src/entities/shipinleibie.entities.ts
import { Yingshishipin } from 'src/admin/yingshishipin/entities/yingshishipin.entity';
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';

@Entity('shipinleibie')
export class Shipinleibie {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    type: 'varchar',
    unique: true,
    length: 255,
    comment: '视频类别名称',
  })
  leibie: string;

  @Column({
    type: 'text',
    nullable: true,
    comment: '备注信息',
  })
  beizhu: string;

  @Column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
    comment: '创建时间',
  })
  createTime: Date;

  @OneToMany(() => Yingshishipin, (yingshi) => yingshi.shipinleibie, {
    onDelete: 'SET NULL',
  })
  yingshishipins: Yingshishipin[]; // 添加反向关系
}
